msgpernickperweekday<- count(messages, unick ,format(datetime,"%A"))
names(msgpernickperweekday) <- c("unick","weekday","n")
msgpernickperweekday$weekday <- factor(msgpernickperweekday$weekday, levels = c("lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche"))
p <- ggplot(data=msgpernickperweekday,aes(reorder(unick,n),n,fill=weekday)) + coord_flip() + geom_bar(stat="identity") + ggtitle(sprintf("Number of messages per weekday for %s", (yeartoload))) + xlab("Username") + ylab("# of messages") + scale_fill_brewer(palette = "Blues")
ggplotly(p,width=800,height=600)
jColors <- usercolors$color
names(jColors) <- usercolors$unick
#ggplot(data=scoreshgt,aes(reorder(unick,hgtscore),hgtscore)) + geom_bar(stat='identity') + coord_flip() + ylab("HGT Score") + xlab("Username")+ ggtitle("HGT Scores per username") + aes(fill=unick)+ scale_fill_manual(values = jColors)+ guides(fill=FALSE)
msgpernickperhour<- count(messages, unick ,hour(datetime))
names(msgpernickperhour) <- c("unick","hour","n")
p <- ggplot(data=msgpernickperhour, aes(x=hour,y=unick)) + geom_point(aes(size=n),pch=21) + aes(color=unick,fill=unick) + scale_fill_manual(values = jColors)+ ylab("# of messages") + ggtitle("Activity per hour for the whole year") + scale_x_continuous(breaks=1:24) + guides(color=FALSE,fill=FALSE)
ggplotly(p,width=800,height=600)
msgperweekpernick <- count(messages, unick ,format(datetime,"%U"))
names(msgperweekpernick) <- c("unick","weeknumber","count")
p <- ggplot(data=msgperweekpernick,aes(weeknumber,count,fill=unick)) + geom_bar(stat='identity')+ scale_fill_manual(values = jColors) + ggtitle("Number of messages per week & per nick") + xlab("Week Number") + ylab("Number of messages")
ggplotly(p,width=800,height=600)
messages2 <- messages
messages2$msg <- as.numeric(nchar(messages2$msg))
messages2 <- messages2[,c(2,4)]
toplot <- aggregate(messages2$msg, by=list(messages2$unick), FUN="mean")
toplot <- toplot[,1:2]
names(toplot) <- c("Nick","averagecharpermsg")
p <- ggplot(toplot,aes(x = Nick,y=averagecharpermsg)) + geom_bar(stat="identity") + coord_flip() + aes(fill=Nick) + scale_fill_manual(values = jColors) + guides(fill=FALSE) + ggtitle("Average number of chars per message") + xlab("Nick") + ylab("Average chars in message")
ggplotly(p,width=800,height=600)
mondayWeekMinus1 <- floor_date(Sys.Date()-7, "week")+1
sundayWeekMinus1 <- floor_date(Sys.Date(), "week")
##For test purposes - fake week-1
#mondayWeekMinus1 <- as.Date("2017-05-01")
#sundayWeekMinus1 <- as.Date("2017-05-07")
msgWEEK <- messages[messages$datetime >=mondayWeekMinus1 & messages$datetime <= sundayWeekMinus1 ,]
msgpernickperhourWEEK <- count(msgWEEK, unick ,hour(datetime))
names(msgpernickperhourWEEK) <- c("unick","hour","n")
p <- ggplot(data=msgpernickperhourWEEK, aes(x=hour,y=unick)) + geom_point(aes(size=n),pch=21) + aes(color=unick,fill=unick) + scale_fill_manual(values = jColors)+ ylab("# of messages") + ggtitle("Activity per hour of previous week") + scale_x_continuous(breaks=1:24) + guides(color=FALSE,fill=FALSE)
ggplotly(p,width=800,height=600)
msgpernickWEEKK <- count(msgWEEK, unick)
p <- ggplot(data=msgpernickWEEKK,aes(reorder(unick,n),n)) + geom_bar(stat='identity') + coord_flip() + ylab("Number of messages") + xlab("Username")+ ggtitle("Most useless at work (previous week)") + aes(fill=unick)+ scale_fill_manual(values = jColors)+ guides(fill=FALSE)
ggplotly(p,width=800,height=600)
temp <- clean.msgs(msgWEEK)
wordcloud(temp$temp,temp$Freq,max.words =500
,random.order=FALSE, rot.per=0.35, min.freq = 4,
colors=brewer.pal(8, "Dark2"))
Last update: 2017-06-20 14:48:00
Last message in database : 2017-06-19 10:34:17